package cn.wolfcode.shop.cloud;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


public class CommonAdvice {

    @ExceptionHandler(BusinessException.class)
    @ResponseBody
    public Result handler(BusinessException ex){
        ex.printStackTrace();
        return Result.error(ex.getCodeMsg());
    }

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result handlerCommon(Exception ex){
        ex.printStackTrace();
        return Result.defaultError();
    }

}
